const bcrypt = require('bcrypt');

async function generatePassword() {
  const password = 'admin123';
  const hash = await bcrypt.hash(password, 10);

  console.log('='.repeat(60));
  console.log('  密码哈希生成工具');
  console.log('='.repeat(60));
  console.log('');
  console.log(`原始密码: ${password}`);
  console.log(`Bcrypt哈希: ${hash}`);
  console.log('');
  console.log('SQL语句:');
  console.log(`UPDATE admins SET password = '${hash}' WHERE username = 'admin';`);
  console.log('');
  console.log('或者插入新管理员:');
  console.log(`INSERT INTO admins (username, password, email) VALUES ('admin', '${hash}', 'admin@test.com');`);
  console.log('');
}

generatePassword();
